<!--<h2 class="contentTitle">属性组修改</h2>-->


<div class="pageContent">
	{if $action_name=='addattrg'}
	<form id="myform" method="post" action="{:U($module_name.'/upattrgroup')}" class="pageForm required-validate" onsubmit="return validateCallback(this,dialogAjaxDone);">
	{else}
	<form id="myform" method="post" action="{:U($module_name.'/upattrgroup')}" class="pageForm required-validate" onsubmit="return validateCallback(this,dialogAjaxDone);">
		{if $id}<input type="hidden" name="id" value="{$id}" />{/if}
	{/if}
		<div class="pageFormContent nowrap" layoutH="97">
			<dl>
				<dt>属性组名称：</dt>
				<dd>
					<input type="text" name="name" maxlength="20" class="required" value="{$attrgroup['name']}" style="float: none;" data-validate="validate(required);"/>
				</dd>
			</dl>
			<dl>
				<dt>模型名称：</dt>
				<dd>
					
					<select name='modelname'  class="required"  >
						<option value=''>请选择</option>
						<volist name='modelname' id='m'>
						<option value='{$m.value}' {if $attrgroup['modelname'] == $m['value']} selected='selected' {/if}>{$m.title}</option>
						</volist>
					</select>
				</dd>
			</dl>
				<dl>
				<dt>排序：</dt>
				<dd>
					<input type="text" name="sequence" maxlength="20" class="required"  
					 placeholder="请输入分组别名" value="{$attrgroup['sequence']}" style="float: none;" data-validate="validate(required,digits);"/>
				</dd>
			</dl>
			<volist name="attrlist" id="a">
				<dl>
				<dt>{$key}：</dt>
					<dd>
						<volist name="a" id="g">
						<input name="ids[]" type="checkbox" value="{$g['id']}" {if in_array($g['id'],$ids)} checked='checked' {/if}/> {$g['value']}
						</volist>
					</dd>
			</dl>
			</volist>			
		</div>
			<div class="formBar">
				<ul>
					<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
					<li>
						<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
					</li>
				</ul>
			</div>		
	</form>
	
</div>

<script>
    $(function(){
        $.ketchup.createErrorContainer(function(form, el) {
            return $('<ul/>', {
                    'class': 'ketchup-custom'
                    }).insertAfter(el);
        }).addErrorMessages(function(form, el, container, messages) {
            container.html('');

            for(i = 0; i < messages.length; i++) {
            $('<li/>', {
                text: messages[i]
            }).appendTo(container);
            }
        }).showErrorContainer(function(form, el, container) {
            container.slideDown('fast');
        }).hideErrorContainer(function(form, el, container) {
            container.slideUp('fast');
        });

        $('#myform').ketchup({
            validateEvents: 'blur keyup'
        });    
    })
</script>